//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2022 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

import Foundation
import SotoCore

extension CloudWatchLogs {
    // MARK: Enums

    public enum DataProtectionStatus: String, CustomStringConvertible, Codable, _SotoSendable {
        case activated = "ACTIVATED"
        case archived = "ARCHIVED"
        case deleted = "DELETED"
        case disabled = "DISABLED"
        public var description: String { return self.rawValue }
    }

    public enum Distribution: String, CustomStringConvertible, Codable, _SotoSendable {
        case byLogStream = "ByLogStream"
        case random = "Random"
        public var description: String { return self.rawValue }
    }

    public enum ExportTaskStatusCode: String, CustomStringConvertible, Codable, _SotoSendable {
        case cancelled = "CANCELLED"
        case completed = "COMPLETED"
        case failed = "FAILED"
        case pending = "PENDING"
        case pendingCancel = "PENDING_CANCEL"
        case running = "RUNNING"
        public var description: String { return self.rawValue }
    }

    public enum OrderBy: String, CustomStringConvertible, Codable, _SotoSendable {
        case lastEventTime = "LastEventTime"
        case logStreamName = "LogStreamName"
        public var description: String { return self.rawValue }
    }

    public enum QueryStatus: String, CustomStringConvertible, Codable, _SotoSendable {
        case cancelled = "Cancelled"
        case complete = "Complete"
        case failed = "Failed"
        case running = "Running"
        case scheduled = "Scheduled"
        case timeout = "Timeout"
        case unknown = "Unknown"
        public var description: String { return self.rawValue }
    }

    public enum StandardUnit: String, CustomStringConvertible, Codable, _SotoSendable {
        case bits = "Bits"
        case bitsSecond = "Bits/Second"
        case bytes = "Bytes"
        case bytesSecond = "Bytes/Second"
        case count = "Count"
        case countSecond = "Count/Second"
        case gigabits = "Gigabits"
        case gigabitsSecond = "Gigabits/Second"
        case gigabytes = "Gigabytes"
        case gigabytesSecond = "Gigabytes/Second"
        case kilobits = "Kilobits"
        case kilobitsSecond = "Kilobits/Second"
        case kilobytes = "Kilobytes"
        case kilobytesSecond = "Kilobytes/Second"
        case megabits = "Megabits"
        case megabitsSecond = "Megabits/Second"
        case megabytes = "Megabytes"
        case megabytesSecond = "Megabytes/Second"
        case microseconds = "Microseconds"
        case milliseconds = "Milliseconds"
        case none = "None"
        case percent = "Percent"
        case seconds = "Seconds"
        case terabits = "Terabits"
        case terabitsSecond = "Terabits/Second"
        case terabytes = "Terabytes"
        case terabytesSecond = "Terabytes/Second"
        public var description: String { return self.rawValue }
    }

    // MARK: Shapes

    public struct AssociateKmsKeyRequest: AWSEncodableShape {
        /// The Amazon Resource Name (ARN) of the KMS key to use when encrypting log data. This must be a symmetric KMS key. For more information, see Amazon Resource Names and Using Symmetric and Asymmetric Keys.
        public let kmsKeyId: String
        /// The name of the log group.
        public let logGroupName: String

        public init(kmsKeyId: String, logGroupName: String) {
            self.kmsKeyId = kmsKeyId
            self.logGroupName = logGroupName
        }

        public func validate(name: String) throws {
            try self.validate(self.kmsKeyId, name: "kmsKeyId", parent: name, max: 256)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case kmsKeyId
            case logGroupName
        }
    }

    public struct CancelExportTaskRequest: AWSEncodableShape {
        /// The ID of the export task.
        public let taskId: String

        public init(taskId: String) {
            self.taskId = taskId
        }

        public func validate(name: String) throws {
            try self.validate(self.taskId, name: "taskId", parent: name, max: 512)
            try self.validate(self.taskId, name: "taskId", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case taskId
        }
    }

    public struct CreateExportTaskRequest: AWSEncodableShape {
        /// The name of S3 bucket for the exported log data. The bucket must be in the same Amazon Web Services Region.
        public let destination: String
        /// The prefix used as the start of the key for every object exported. If you don't specify a value, the default is exportedlogs.
        public let destinationPrefix: String?
        /// The start time of the range for the request, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp earlier than this time are not exported.
        public let from: Int64
        /// The name of the log group.
        public let logGroupName: String
        /// Export only log streams that match the provided prefix. If you don't specify a value, no prefix filter is applied.
        public let logStreamNamePrefix: String?
        /// The name of the export task.
        public let taskName: String?
        /// The end time of the range for the request, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp later than this time are not exported. You must specify a time that is not earlier than when this log group was created.
        public let to: Int64

        public init(destination: String, destinationPrefix: String? = nil, from: Int64, logGroupName: String, logStreamNamePrefix: String? = nil, taskName: String? = nil, to: Int64) {
            self.destination = destination
            self.destinationPrefix = destinationPrefix
            self.from = from
            self.logGroupName = logGroupName
            self.logStreamNamePrefix = logStreamNamePrefix
            self.taskName = taskName
            self.to = to
        }

        public func validate(name: String) throws {
            try self.validate(self.destination, name: "destination", parent: name, max: 512)
            try self.validate(self.destination, name: "destination", parent: name, min: 1)
            try self.validate(self.from, name: "from", parent: name, min: 0)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
            try self.validate(self.logStreamNamePrefix, name: "logStreamNamePrefix", parent: name, max: 512)
            try self.validate(self.logStreamNamePrefix, name: "logStreamNamePrefix", parent: name, min: 1)
            try self.validate(self.logStreamNamePrefix, name: "logStreamNamePrefix", parent: name, pattern: "^[^:*]*$")
            try self.validate(self.taskName, name: "taskName", parent: name, max: 512)
            try self.validate(self.taskName, name: "taskName", parent: name, min: 1)
            try self.validate(self.to, name: "to", parent: name, min: 0)
        }

        private enum CodingKeys: String, CodingKey {
            case destination
            case destinationPrefix
            case from
            case logGroupName
            case logStreamNamePrefix
            case taskName
            case to
        }
    }

    public struct CreateExportTaskResponse: AWSDecodableShape {
        /// The ID of the export task.
        public let taskId: String?

        public init(taskId: String? = nil) {
            self.taskId = taskId
        }

        private enum CodingKeys: String, CodingKey {
            case taskId
        }
    }

    public struct CreateLogGroupRequest: AWSEncodableShape {
        /// The Amazon Resource Name (ARN) of the KMS key to use when encrypting log data. For more information, see Amazon Resource Names.
        public let kmsKeyId: String?
        /// The name of the log group.
        public let logGroupName: String
        /// The key-value pairs to use for the tags. You can grant users access to certain log groups while preventing them from accessing other log groups. To do so, tag your groups and use IAM policies that refer to those tags. To assign tags when  you create a log group, you must have either the logs:TagResource or logs:TagLogGroup permission. For more information about tagging, see  Tagging Amazon Web Services resources. For more information about using tags to control access, see  Controlling access to Amazon Web Services resources using tags.
        public let tags: [String: String]?

        public init(kmsKeyId: String? = nil, logGroupName: String, tags: [String: String]? = nil) {
            self.kmsKeyId = kmsKeyId
            self.logGroupName = logGroupName
            self.tags = tags
        }

        public func validate(name: String) throws {
            try self.validate(self.kmsKeyId, name: "kmsKeyId", parent: name, max: 256)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
            try self.tags?.forEach {
                try validate($0.key, name: "tags.key", parent: name, max: 128)
                try validate($0.key, name: "tags.key", parent: name, min: 1)
                try validate($0.key, name: "tags.key", parent: name, pattern: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]+)$")
                try validate($0.value, name: "tags[\"\($0.key)\"]", parent: name, max: 256)
                try validate($0.value, name: "tags[\"\($0.key)\"]", parent: name, pattern: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$")
            }
            try self.validate(self.tags, name: "tags", parent: name, max: 50)
            try self.validate(self.tags, name: "tags", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case kmsKeyId
            case logGroupName
            case tags
        }
    }

    public struct CreateLogStreamRequest: AWSEncodableShape {
        /// The name of the log group.
        public let logGroupName: String
        /// The name of the log stream.
        public let logStreamName: String

        public init(logGroupName: String, logStreamName: String) {
            self.logGroupName = logGroupName
            self.logStreamName = logStreamName
        }

        public func validate(name: String) throws {
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
            try self.validate(self.logStreamName, name: "logStreamName", parent: name, max: 512)
            try self.validate(self.logStreamName, name: "logStreamName", parent: name, min: 1)
            try self.validate(self.logStreamName, name: "logStreamName", parent: name, pattern: "^[^:*]*$")
        }

        private enum CodingKeys: String, CodingKey {
            case logGroupName
            case logStreamName
        }
    }

    public struct DeleteDataProtectionPolicyRequest: AWSEncodableShape {
        /// The name or ARN of the log group that you want to delete the data protection policy for.
        public let logGroupIdentifier: String

        public init(logGroupIdentifier: String) {
            self.logGroupIdentifier = logGroupIdentifier
        }

        public func validate(name: String) throws {
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, max: 2048)
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, min: 1)
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, pattern: "^[\\w#+=/:,.@-]*$")
        }

        private enum CodingKeys: String, CodingKey {
            case logGroupIdentifier
        }
    }

    public struct DeleteDestinationRequest: AWSEncodableShape {
        /// The name of the destination.
        public let destinationName: String

        public init(destinationName: String) {
            self.destinationName = destinationName
        }

        public func validate(name: String) throws {
            try self.validate(self.destinationName, name: "destinationName", parent: name, max: 512)
            try self.validate(self.destinationName, name: "destinationName", parent: name, min: 1)
            try self.validate(self.destinationName, name: "destinationName", parent: name, pattern: "^[^:*]*$")
        }

        private enum CodingKeys: String, CodingKey {
            case destinationName
        }
    }

    public struct DeleteLogGroupRequest: AWSEncodableShape {
        /// The name of the log group.
        public let logGroupName: String

        public init(logGroupName: String) {
            self.logGroupName = logGroupName
        }

        public func validate(name: String) throws {
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case logGroupName
        }
    }

    public struct DeleteLogStreamRequest: AWSEncodableShape {
        /// The name of the log group.
        public let logGroupName: String
        /// The name of the log stream.
        public let logStreamName: String

        public init(logGroupName: String, logStreamName: String) {
            self.logGroupName = logGroupName
            self.logStreamName = logStreamName
        }

        public func validate(name: String) throws {
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
            try self.validate(self.logStreamName, name: "logStreamName", parent: name, max: 512)
            try self.validate(self.logStreamName, name: "logStreamName", parent: name, min: 1)
            try self.validate(self.logStreamName, name: "logStreamName", parent: name, pattern: "^[^:*]*$")
        }

        private enum CodingKeys: String, CodingKey {
            case logGroupName
            case logStreamName
        }
    }

    public struct DeleteMetricFilterRequest: AWSEncodableShape {
        /// The name of the metric filter.
        public let filterName: String
        /// The name of the log group.
        public let logGroupName: String

        public init(filterName: String, logGroupName: String) {
            self.filterName = filterName
            self.logGroupName = logGroupName
        }

        public func validate(name: String) throws {
            try self.validate(self.filterName, name: "filterName", parent: name, max: 512)
            try self.validate(self.filterName, name: "filterName", parent: name, min: 1)
            try self.validate(self.filterName, name: "filterName", parent: name, pattern: "^[^:*]*$")
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case filterName
            case logGroupName
        }
    }

    public struct DeleteQueryDefinitionRequest: AWSEncodableShape {
        /// The ID of the query definition that you want to delete. You can use DescribeQueryDefinitions to retrieve the IDs of your saved query definitions.
        public let queryDefinitionId: String

        public init(queryDefinitionId: String) {
            self.queryDefinitionId = queryDefinitionId
        }

        public func validate(name: String) throws {
            try self.validate(self.queryDefinitionId, name: "queryDefinitionId", parent: name, max: 256)
        }

        private enum CodingKeys: String, CodingKey {
            case queryDefinitionId
        }
    }

    public struct DeleteQueryDefinitionResponse: AWSDecodableShape {
        /// A value of TRUE indicates that the operation succeeded. FALSE indicates that the operation failed.
        public let success: Bool?

        public init(success: Bool? = nil) {
            self.success = success
        }

        private enum CodingKeys: String, CodingKey {
            case success
        }
    }

    public struct DeleteResourcePolicyRequest: AWSEncodableShape {
        /// The name of the policy to be revoked. This parameter is required.
        public let policyName: String?

        public init(policyName: String? = nil) {
            self.policyName = policyName
        }

        private enum CodingKeys: String, CodingKey {
            case policyName
        }
    }

    public struct DeleteRetentionPolicyRequest: AWSEncodableShape {
        /// The name of the log group.
        public let logGroupName: String

        public init(logGroupName: String) {
            self.logGroupName = logGroupName
        }

        public func validate(name: String) throws {
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case logGroupName
        }
    }

    public struct DeleteSubscriptionFilterRequest: AWSEncodableShape {
        /// The name of the subscription filter.
        public let filterName: String
        /// The name of the log group.
        public let logGroupName: String

        public init(filterName: String, logGroupName: String) {
            self.filterName = filterName
            self.logGroupName = logGroupName
        }

        public func validate(name: String) throws {
            try self.validate(self.filterName, name: "filterName", parent: name, max: 512)
            try self.validate(self.filterName, name: "filterName", parent: name, min: 1)
            try self.validate(self.filterName, name: "filterName", parent: name, pattern: "^[^:*]*$")
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case filterName
            case logGroupName
        }
    }

    public struct DescribeDestinationsRequest: AWSEncodableShape {
        /// The prefix to match. If you don't specify a value, no prefix filter is applied.
        public let destinationNamePrefix: String?
        /// The maximum number of items returned. If you don't specify a value, the default maximum value of  50 items is used.
        public let limit: Int?
        /// The token for the next set of items to return. (You received this token from a previous call.)
        public let nextToken: String?

        public init(destinationNamePrefix: String? = nil, limit: Int? = nil, nextToken: String? = nil) {
            self.destinationNamePrefix = destinationNamePrefix
            self.limit = limit
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try self.validate(self.destinationNamePrefix, name: "destinationNamePrefix", parent: name, max: 512)
            try self.validate(self.destinationNamePrefix, name: "destinationNamePrefix", parent: name, min: 1)
            try self.validate(self.destinationNamePrefix, name: "destinationNamePrefix", parent: name, pattern: "^[^:*]*$")
            try self.validate(self.limit, name: "limit", parent: name, max: 50)
            try self.validate(self.limit, name: "limit", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case destinationNamePrefix = "DestinationNamePrefix"
            case limit
            case nextToken
        }
    }

    public struct DescribeDestinationsResponse: AWSDecodableShape {
        /// The destinations.
        public let destinations: [Destination]?
        public let nextToken: String?

        public init(destinations: [Destination]? = nil, nextToken: String? = nil) {
            self.destinations = destinations
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case destinations
            case nextToken
        }
    }

    public struct DescribeExportTasksRequest: AWSEncodableShape {
        /// The maximum number of items returned. If you don't specify a value, the default is up to 50 items.
        public let limit: Int?
        /// The token for the next set of items to return. (You received this token from a previous call.)
        public let nextToken: String?
        /// The status code of the export task. Specifying a status code filters the results to zero or more export tasks.
        public let statusCode: ExportTaskStatusCode?
        /// The ID of the export task. Specifying a task ID filters the results to one or zero export tasks.
        public let taskId: String?

        public init(limit: Int? = nil, nextToken: String? = nil, statusCode: ExportTaskStatusCode? = nil, taskId: String? = nil) {
            self.limit = limit
            self.nextToken = nextToken
            self.statusCode = statusCode
            self.taskId = taskId
        }

        public func validate(name: String) throws {
            try self.validate(self.limit, name: "limit", parent: name, max: 50)
            try self.validate(self.limit, name: "limit", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
            try self.validate(self.taskId, name: "taskId", parent: name, max: 512)
            try self.validate(self.taskId, name: "taskId", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case limit
            case nextToken
            case statusCode
            case taskId
        }
    }

    public struct DescribeExportTasksResponse: AWSDecodableShape {
        /// The export tasks.
        public let exportTasks: [ExportTask]?
        public let nextToken: String?

        public init(exportTasks: [ExportTask]? = nil, nextToken: String? = nil) {
            self.exportTasks = exportTasks
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case exportTasks
            case nextToken
        }
    }

    public struct DescribeLogGroupsRequest: AWSEncodableShape {
        /// When includeLinkedAccounts is set to True, use this parameter to specify the list of accounts to search. You can specify as many as 20 account IDs in the array.
        public let accountIdentifiers: [String]?
        /// If you are using a monitoring account, set this to True to have the operation return log groups in  the accounts listed in accountIdentifiers.
        ///   If this parameter is set to true and accountIdentifiers
        ///  contains a null value, the operation returns all log groups in the monitoring account and all log groups in all source accounts that are linked to the monitoring account.   If you specify includeLinkedAccounts in your request, then metricFilterCount, retentionInDays, and storedBytes are not included in the response.
        public let includeLinkedAccounts: Bool?
        /// The maximum number of items returned. If you don't specify a value, the default is up to 50 items.
        public let limit: Int?
        /// If you specify a string for this parameter, the operation returns only log groups that have names
        /// that match the string based on a case-sensitive substring search. For example, if you specify Foo, log groups
        /// named FooBar, aws/Foo, and GroupFoo would match, but foo,
        /// F/o/o and Froo would not match.      logGroupNamePattern and logGroupNamePrefix are mutually exclusive.  Only one  of these parameters can be passed.
        public let logGroupNamePattern: String?
        /// The prefix to match.   logGroupNamePrefix and logGroupNamePattern are mutually exclusive.  Only one  of these parameters can be passed.
        public let logGroupNamePrefix: String?
        /// The token for the next set of items to return. (You received this token from a previous call.)
        public let nextToken: String?

        public init(accountIdentifiers: [String]? = nil, includeLinkedAccounts: Bool? = nil, limit: Int? = nil, logGroupNamePattern: String? = nil, logGroupNamePrefix: String? = nil, nextToken: String? = nil) {
            self.accountIdentifiers = accountIdentifiers
            self.includeLinkedAccounts = includeLinkedAccounts
            self.limit = limit
            self.logGroupNamePattern = logGroupNamePattern
            self.logGroupNamePrefix = logGroupNamePrefix
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try self.accountIdentifiers?.forEach {
                try validate($0, name: "accountIdentifiers[]", parent: name, max: 12)
                try validate($0, name: "accountIdentifiers[]", parent: name, min: 12)
                try validate($0, name: "accountIdentifiers[]", parent: name, pattern: "^\\d{12}$")
            }
            try self.validate(self.accountIdentifiers, name: "accountIdentifiers", parent: name, max: 20)
            try self.validate(self.limit, name: "limit", parent: name, max: 50)
            try self.validate(self.limit, name: "limit", parent: name, min: 1)
            try self.validate(self.logGroupNamePattern, name: "logGroupNamePattern", parent: name, max: 512)
            try self.validate(self.logGroupNamePattern, name: "logGroupNamePattern", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]*$")
            try self.validate(self.logGroupNamePrefix, name: "logGroupNamePrefix", parent: name, max: 512)
            try self.validate(self.logGroupNamePrefix, name: "logGroupNamePrefix", parent: name, min: 1)
            try self.validate(self.logGroupNamePrefix, name: "logGroupNamePrefix", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case accountIdentifiers
            case includeLinkedAccounts
            case limit
            case logGroupNamePattern
            case logGroupNamePrefix
            case nextToken
        }
    }

    public struct DescribeLogGroupsResponse: AWSDecodableShape {
        /// The log groups. If the retentionInDays value is not included for a log group, then that log group's events do not expire.
        public let logGroups: [LogGroup]?
        public let nextToken: String?

        public init(logGroups: [LogGroup]? = nil, nextToken: String? = nil) {
            self.logGroups = logGroups
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case logGroups
            case nextToken
        }
    }

    public struct DescribeLogStreamsRequest: AWSEncodableShape {
        /// If the value is true, results are returned in descending order.  If the value is to false, results are returned in ascending order. The default value is false.
        public let descending: Bool?
        /// The maximum number of items returned. If you don't specify a value, the default is up to 50 items.
        public let limit: Int?
        /// Specify either the name or ARN of the log group to view. If the log group is in a source account and you are using a monitoring account, you must use the log group ARN. If you specify values for both logGroupName and logGroupIdentifier, the action returns an InvalidParameterException error.
        public let logGroupIdentifier: String?
        /// The name of the log group.   If you specify values for both logGroupName and logGroupIdentifier,  the action returns an InvalidParameterException error.
        public let logGroupName: String
        /// The prefix to match.  If orderBy is LastEventTime, you cannot specify this parameter.
        public let logStreamNamePrefix: String?
        /// The token for the next set of items to return. (You received this token from a previous call.)
        public let nextToken: String?
        /// If the value is LogStreamName, the results are ordered by log stream name. If the value is LastEventTime, the results are ordered by the event time.  The default value is LogStreamName. If you order the results by event time, you cannot specify the logStreamNamePrefix parameter.  lastEventTimestamp represents the time of the most recent log event in the log stream in CloudWatch Logs. This number is expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. lastEventTimestamp updates on an eventual consistency basis. It typically updates in less than an hour from ingestion, but in rare situations might take longer.
        public let orderBy: OrderBy?

        public init(descending: Bool? = nil, limit: Int? = nil, logGroupIdentifier: String? = nil, logGroupName: String, logStreamNamePrefix: String? = nil, nextToken: String? = nil, orderBy: OrderBy? = nil) {
            self.descending = descending
            self.limit = limit
            self.logGroupIdentifier = logGroupIdentifier
            self.logGroupName = logGroupName
            self.logStreamNamePrefix = logStreamNamePrefix
            self.nextToken = nextToken
            self.orderBy = orderBy
        }

        public func validate(name: String) throws {
            try self.validate(self.limit, name: "limit", parent: name, max: 50)
            try self.validate(self.limit, name: "limit", parent: name, min: 1)
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, max: 2048)
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, min: 1)
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, pattern: "^[\\w#+=/:,.@-]*$")
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
            try self.validate(self.logStreamNamePrefix, name: "logStreamNamePrefix", parent: name, max: 512)
            try self.validate(self.logStreamNamePrefix, name: "logStreamNamePrefix", parent: name, min: 1)
            try self.validate(self.logStreamNamePrefix, name: "logStreamNamePrefix", parent: name, pattern: "^[^:*]*$")
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case descending
            case limit
            case logGroupIdentifier
            case logGroupName
            case logStreamNamePrefix
            case nextToken
            case orderBy
        }
    }

    public struct DescribeLogStreamsResponse: AWSDecodableShape {
        /// The log streams.
        public let logStreams: [LogStream]?
        public let nextToken: String?

        public init(logStreams: [LogStream]? = nil, nextToken: String? = nil) {
            self.logStreams = logStreams
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case logStreams
            case nextToken
        }
    }

    public struct DescribeMetricFiltersRequest: AWSEncodableShape {
        /// The prefix to match. CloudWatch Logs uses the value that you set here only if you also include the logGroupName parameter in your request.
        public let filterNamePrefix: String?
        /// The maximum number of items returned. If you don't specify a value, the default is up to 50 items.
        public let limit: Int?
        /// The name of the log group.
        public let logGroupName: String?
        /// Filters results to include only those with the specified metric name. If you include this parameter in your request, you  must also include the metricNamespace parameter.
        public let metricName: String?
        /// Filters results to include only those in the specified namespace. If you include this parameter in your request, you  must also include the metricName parameter.
        public let metricNamespace: String?
        /// The token for the next set of items to return. (You received this token from a previous call.)
        public let nextToken: String?

        public init(filterNamePrefix: String? = nil, limit: Int? = nil, logGroupName: String? = nil, metricName: String? = nil, metricNamespace: String? = nil, nextToken: String? = nil) {
            self.filterNamePrefix = filterNamePrefix
            self.limit = limit
            self.logGroupName = logGroupName
            self.metricName = metricName
            self.metricNamespace = metricNamespace
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try self.validate(self.filterNamePrefix, name: "filterNamePrefix", parent: name, max: 512)
            try self.validate(self.filterNamePrefix, name: "filterNamePrefix", parent: name, min: 1)
            try self.validate(self.filterNamePrefix, name: "filterNamePrefix", parent: name, pattern: "^[^:*]*$")
            try self.validate(self.limit, name: "limit", parent: name, max: 50)
            try self.validate(self.limit, name: "limit", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
            try self.validate(self.metricName, name: "metricName", parent: name, max: 255)
            try self.validate(self.metricName, name: "metricName", parent: name, pattern: "^[^:*$]*$")
            try self.validate(self.metricNamespace, name: "metricNamespace", parent: name, max: 255)
            try self.validate(self.metricNamespace, name: "metricNamespace", parent: name, pattern: "^[^:*$]*$")
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case filterNamePrefix
            case limit
            case logGroupName
            case metricName
            case metricNamespace
            case nextToken
        }
    }

    public struct DescribeMetricFiltersResponse: AWSDecodableShape {
        /// The metric filters.
        public let metricFilters: [MetricFilter]?
        public let nextToken: String?

        public init(metricFilters: [MetricFilter]? = nil, nextToken: String? = nil) {
            self.metricFilters = metricFilters
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case metricFilters
            case nextToken
        }
    }

    public struct DescribeQueriesRequest: AWSEncodableShape {
        /// Limits the returned queries to only those for the specified log group.
        public let logGroupName: String?
        /// Limits the number of returned queries to the specified number.
        public let maxResults: Int?
        public let nextToken: String?
        /// Limits the returned queries to only those that have the specified status. Valid values are Cancelled,  Complete, Failed, Running, and Scheduled.
        public let status: QueryStatus?

        public init(logGroupName: String? = nil, maxResults: Int? = nil, nextToken: String? = nil, status: QueryStatus? = nil) {
            self.logGroupName = logGroupName
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.status = status
        }

        public func validate(name: String) throws {
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 1000)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case logGroupName
            case maxResults
            case nextToken
            case status
        }
    }

    public struct DescribeQueriesResponse: AWSDecodableShape {
        public let nextToken: String?
        /// The list of queries that match the request.
        public let queries: [QueryInfo]?

        public init(nextToken: String? = nil, queries: [QueryInfo]? = nil) {
            self.nextToken = nextToken
            self.queries = queries
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken
            case queries
        }
    }

    public struct DescribeQueryDefinitionsRequest: AWSEncodableShape {
        /// Limits the number of returned query definitions to the specified number.
        public let maxResults: Int?
        public let nextToken: String?
        /// Use this parameter to filter your results to only the query definitions that have names that start with the prefix you specify.
        public let queryDefinitionNamePrefix: String?

        public init(maxResults: Int? = nil, nextToken: String? = nil, queryDefinitionNamePrefix: String? = nil) {
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.queryDefinitionNamePrefix = queryDefinitionNamePrefix
        }

        public func validate(name: String) throws {
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 1000)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
            try self.validate(self.queryDefinitionNamePrefix, name: "queryDefinitionNamePrefix", parent: name, max: 255)
            try self.validate(self.queryDefinitionNamePrefix, name: "queryDefinitionNamePrefix", parent: name, min: 1)
            try self.validate(self.queryDefinitionNamePrefix, name: "queryDefinitionNamePrefix", parent: name, pattern: "^([^:*\\/]+\\/?)*[^:*\\/]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case maxResults
            case nextToken
            case queryDefinitionNamePrefix
        }
    }

    public struct DescribeQueryDefinitionsResponse: AWSDecodableShape {
        public let nextToken: String?
        /// The list of query definitions that match your request.
        public let queryDefinitions: [QueryDefinition]?

        public init(nextToken: String? = nil, queryDefinitions: [QueryDefinition]? = nil) {
            self.nextToken = nextToken
            self.queryDefinitions = queryDefinitions
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken
            case queryDefinitions
        }
    }

    public struct DescribeResourcePoliciesRequest: AWSEncodableShape {
        /// The maximum number of resource policies to be displayed with one call of this API.
        public let limit: Int?
        public let nextToken: String?

        public init(limit: Int? = nil, nextToken: String? = nil) {
            self.limit = limit
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try self.validate(self.limit, name: "limit", parent: name, max: 50)
            try self.validate(self.limit, name: "limit", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case limit
            case nextToken
        }
    }

    public struct DescribeResourcePoliciesResponse: AWSDecodableShape {
        public let nextToken: String?
        /// The resource policies that exist in this account.
        public let resourcePolicies: [ResourcePolicy]?

        public init(nextToken: String? = nil, resourcePolicies: [ResourcePolicy]? = nil) {
            self.nextToken = nextToken
            self.resourcePolicies = resourcePolicies
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken
            case resourcePolicies
        }
    }

    public struct DescribeSubscriptionFiltersRequest: AWSEncodableShape {
        /// The prefix to match. If you don't specify a value, no prefix filter is applied.
        public let filterNamePrefix: String?
        /// The maximum number of items returned. If you don't specify a value, the default is up to 50 items.
        public let limit: Int?
        /// The name of the log group.
        public let logGroupName: String
        /// The token for the next set of items to return. (You received this token from a previous call.)
        public let nextToken: String?

        public init(filterNamePrefix: String? = nil, limit: Int? = nil, logGroupName: String, nextToken: String? = nil) {
            self.filterNamePrefix = filterNamePrefix
            self.limit = limit
            self.logGroupName = logGroupName
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try self.validate(self.filterNamePrefix, name: "filterNamePrefix", parent: name, max: 512)
            try self.validate(self.filterNamePrefix, name: "filterNamePrefix", parent: name, min: 1)
            try self.validate(self.filterNamePrefix, name: "filterNamePrefix", parent: name, pattern: "^[^:*]*$")
            try self.validate(self.limit, name: "limit", parent: name, max: 50)
            try self.validate(self.limit, name: "limit", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case filterNamePrefix
            case limit
            case logGroupName
            case nextToken
        }
    }

    public struct DescribeSubscriptionFiltersResponse: AWSDecodableShape {
        public let nextToken: String?
        /// The subscription filters.
        public let subscriptionFilters: [SubscriptionFilter]?

        public init(nextToken: String? = nil, subscriptionFilters: [SubscriptionFilter]? = nil) {
            self.nextToken = nextToken
            self.subscriptionFilters = subscriptionFilters
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken
            case subscriptionFilters
        }
    }

    public struct Destination: AWSDecodableShape {
        /// An IAM policy document that governs which Amazon Web Services accounts can create subscription filters against this destination.
        public let accessPolicy: String?
        /// The ARN of this destination.
        public let arn: String?
        /// The creation time of the destination, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
        public let creationTime: Int64?
        /// The name of the destination.
        public let destinationName: String?
        /// A role for impersonation, used when delivering log events to the target.
        public let roleArn: String?
        /// The Amazon Resource Name (ARN) of the physical target where the log events are delivered (for example, a Kinesis stream).
        public let targetArn: String?

        public init(accessPolicy: String? = nil, arn: String? = nil, creationTime: Int64? = nil, destinationName: String? = nil, roleArn: String? = nil, targetArn: String? = nil) {
            self.accessPolicy = accessPolicy
            self.arn = arn
            self.creationTime = creationTime
            self.destinationName = destinationName
            self.roleArn = roleArn
            self.targetArn = targetArn
        }

        private enum CodingKeys: String, CodingKey {
            case accessPolicy
            case arn
            case creationTime
            case destinationName
            case roleArn
            case targetArn
        }
    }

    public struct DisassociateKmsKeyRequest: AWSEncodableShape {
        /// The name of the log group.
        public let logGroupName: String

        public init(logGroupName: String) {
            self.logGroupName = logGroupName
        }

        public func validate(name: String) throws {
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case logGroupName
        }
    }

    public struct ExportTask: AWSDecodableShape {
        /// The name of the S3 bucket to which the log data was exported.
        public let destination: String?
        /// The prefix that was used as the start of Amazon S3 key for every object exported.
        public let destinationPrefix: String?
        /// Execution information about the export task.
        public let executionInfo: ExportTaskExecutionInfo?
        /// The start time, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp before this time are not exported.
        public let from: Int64?
        /// The name of the log group from which logs data was exported.
        public let logGroupName: String?
        /// The status of the export task.
        public let status: ExportTaskStatus?
        /// The ID of the export task.
        public let taskId: String?
        /// The name of the export task.
        public let taskName: String?
        /// The end time, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp later than this time are not exported.
        public let to: Int64?

        public init(destination: String? = nil, destinationPrefix: String? = nil, executionInfo: ExportTaskExecutionInfo? = nil, from: Int64? = nil, logGroupName: String? = nil, status: ExportTaskStatus? = nil, taskId: String? = nil, taskName: String? = nil, to: Int64? = nil) {
            self.destination = destination
            self.destinationPrefix = destinationPrefix
            self.executionInfo = executionInfo
            self.from = from
            self.logGroupName = logGroupName
            self.status = status
            self.taskId = taskId
            self.taskName = taskName
            self.to = to
        }

        private enum CodingKeys: String, CodingKey {
            case destination
            case destinationPrefix
            case executionInfo
            case from
            case logGroupName
            case status
            case taskId
            case taskName
            case to
        }
    }

    public struct ExportTaskExecutionInfo: AWSDecodableShape {
        /// The completion time of the export task, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
        public let completionTime: Int64?
        /// The creation time of the export task, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
        public let creationTime: Int64?

        public init(completionTime: Int64? = nil, creationTime: Int64? = nil) {
            self.completionTime = completionTime
            self.creationTime = creationTime
        }

        private enum CodingKeys: String, CodingKey {
            case completionTime
            case creationTime
        }
    }

    public struct ExportTaskStatus: AWSDecodableShape {
        /// The status code of the export task.
        public let code: ExportTaskStatusCode?
        /// The status message related to the status code.
        public let message: String?

        public init(code: ExportTaskStatusCode? = nil, message: String? = nil) {
            self.code = code
            self.message = message
        }

        private enum CodingKeys: String, CodingKey {
            case code
            case message
        }
    }

    public struct FilterLogEventsRequest: AWSEncodableShape {
        /// The end of the time range, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp later than this time are not returned.
        public let endTime: Int64?
        /// The filter pattern to use. For more information, see Filter and Pattern Syntax. If not provided, all the events are matched.
        public let filterPattern: String?
        /// If the value is true, the operation attempts to provide responses that contain events from multiple log streams within the log group, interleaved in a single response. If the value is false, all the matched log events in the first log stream are searched first, then those in the next log stream, and so on.  Important As of June 17, 2019, this parameter is ignored and the value is assumed to be true. The response from this operation always interleaves events from multiple log streams within a log group.
        public let interleaved: Bool?
        /// The maximum number of events to return. The default is 10,000 events.
        public let limit: Int?
        /// Specify either the name or ARN of the log group to view log events from. If the log group is in a source account and you are using a monitoring account, you must use the log group ARN. If you specify values for both logGroupName and logGroupIdentifier, the action returns an InvalidParameterException error.
        public let logGroupIdentifier: String?
        /// The name of the log group to search.   If you specify values for both logGroupName and logGroupIdentifier,  the action returns an InvalidParameterException error.
        public let logGroupName: String
        /// Filters the results to include only events from log streams that have names starting with this prefix. If you specify a value for both logStreamNamePrefix and logStreamNames, but the value for logStreamNamePrefix does not match any log stream names specified in logStreamNames, the action returns an InvalidParameterException error.
        public let logStreamNamePrefix: String?
        /// Filters the results to only logs from the log streams in this list. If you specify a value for both logStreamNamePrefix and logStreamNames, the action returns an InvalidParameterException error.
        public let logStreamNames: [String]?
        /// The token for the next set of events to return. (You received this token from a previous call.)
        public let nextToken: String?
        /// The start of the time range, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp before this time are not returned.
        public let startTime: Int64?
        /// Specify true to display the log event fields with all sensitive data unmasked and visible. The default is false. To use this operation with this parameter, you must be signed into an account with the logs:Unmask permission.
        public let unmask: Bool?

        public init(endTime: Int64? = nil, filterPattern: String? = nil, limit: Int? = nil, logGroupIdentifier: String? = nil, logGroupName: String, logStreamNamePrefix: String? = nil, logStreamNames: [String]? = nil, nextToken: String? = nil, startTime: Int64? = nil, unmask: Bool? = nil) {
            self.endTime = endTime
            self.filterPattern = filterPattern
            self.interleaved = nil
            self.limit = limit
            self.logGroupIdentifier = logGroupIdentifier
            self.logGroupName = logGroupName
            self.logStreamNamePrefix = logStreamNamePrefix
            self.logStreamNames = logStreamNames
            self.nextToken = nextToken
            self.startTime = startTime
            self.unmask = unmask
        }

        @available(*, deprecated, message: "Members interleaved have been deprecated")
        public init(endTime: Int64? = nil, filterPattern: String? = nil, interleaved: Bool? = nil, limit: Int? = nil, logGroupIdentifier: String? = nil, logGroupName: String, logStreamNamePrefix: String? = nil, logStreamNames: [String]? = nil, nextToken: String? = nil, startTime: Int64? = nil, unmask: Bool? = nil) {
            self.endTime = endTime
            self.filterPattern = filterPattern
            self.interleaved = interleaved
            self.limit = limit
            self.logGroupIdentifier = logGroupIdentifier
            self.logGroupName = logGroupName
            self.logStreamNamePrefix = logStreamNamePrefix
            self.logStreamNames = logStreamNames
            self.nextToken = nextToken
            self.startTime = startTime
            self.unmask = unmask
        }

        public func validate(name: String) throws {
            try self.validate(self.endTime, name: "endTime", parent: name, min: 0)
            try self.validate(self.filterPattern, name: "filterPattern", parent: name, max: 1024)
            try self.validate(self.limit, name: "limit", parent: name, max: 10000)
            try self.validate(self.limit, name: "limit", parent: name, min: 1)
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, max: 2048)
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, min: 1)
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, pattern: "^[\\w#+=/:,.@-]*$")
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
            try self.validate(self.logStreamNamePrefix, name: "logStreamNamePrefix", parent: name, max: 512)
            try self.validate(self.logStreamNamePrefix, name: "logStreamNamePrefix", parent: name, min: 1)
            try self.validate(self.logStreamNamePrefix, name: "logStreamNamePrefix", parent: name, pattern: "^[^:*]*$")
            try self.logStreamNames?.forEach {
                try validate($0, name: "logStreamNames[]", parent: name, max: 512)
                try validate($0, name: "logStreamNames[]", parent: name, min: 1)
                try validate($0, name: "logStreamNames[]", parent: name, pattern: "^[^:*]*$")
            }
            try self.validate(self.logStreamNames, name: "logStreamNames", parent: name, max: 100)
            try self.validate(self.logStreamNames, name: "logStreamNames", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
            try self.validate(self.startTime, name: "startTime", parent: name, min: 0)
        }

        private enum CodingKeys: String, CodingKey {
            case endTime
            case filterPattern
            case interleaved
            case limit
            case logGroupIdentifier
            case logGroupName
            case logStreamNamePrefix
            case logStreamNames
            case nextToken
            case startTime
            case unmask
        }
    }

    public struct FilterLogEventsResponse: AWSDecodableShape {
        /// The matched events.
        public let events: [FilteredLogEvent]?
        /// The token to use when requesting the next set of items. The token expires after 24 hours.
        public let nextToken: String?
        ///  Important As of May 15, 2020, this parameter is no longer supported. This parameter returns an empty list. Indicates which log streams have been searched and whether each has been searched completely.
        public let searchedLogStreams: [SearchedLogStream]?

        public init(events: [FilteredLogEvent]? = nil, nextToken: String? = nil, searchedLogStreams: [SearchedLogStream]? = nil) {
            self.events = events
            self.nextToken = nextToken
            self.searchedLogStreams = searchedLogStreams
        }

        private enum CodingKeys: String, CodingKey {
            case events
            case nextToken
            case searchedLogStreams
        }
    }

    public struct FilteredLogEvent: AWSDecodableShape {
        /// The ID of the event.
        public let eventId: String?
        /// The time the event was ingested, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
        public let ingestionTime: Int64?
        /// The name of the log stream to which this event belongs.
        public let logStreamName: String?
        /// The data contained in the log event.
        public let message: String?
        /// The time the event occurred, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
        public let timestamp: Int64?

        public init(eventId: String? = nil, ingestionTime: Int64? = nil, logStreamName: String? = nil, message: String? = nil, timestamp: Int64? = nil) {
            self.eventId = eventId
            self.ingestionTime = ingestionTime
            self.logStreamName = logStreamName
            self.message = message
            self.timestamp = timestamp
        }

        private enum CodingKeys: String, CodingKey {
            case eventId
            case ingestionTime
            case logStreamName
            case message
            case timestamp
        }
    }

    public struct GetDataProtectionPolicyRequest: AWSEncodableShape {
        /// The name or ARN of the log group that contains the data protection policy that you want to see.
        public let logGroupIdentifier: String

        public init(logGroupIdentifier: String) {
            self.logGroupIdentifier = logGroupIdentifier
        }

        public func validate(name: String) throws {
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, max: 2048)
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, min: 1)
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, pattern: "^[\\w#+=/:,.@-]*$")
        }

        private enum CodingKeys: String, CodingKey {
            case logGroupIdentifier
        }
    }

    public struct GetDataProtectionPolicyResponse: AWSDecodableShape {
        /// The date and time that this policy was most recently updated.
        public let lastUpdatedTime: Int64?
        /// The log group name or ARN that you specified in your request.
        public let logGroupIdentifier: String?
        /// The data protection policy document for this log group.
        public let policyDocument: String?

        public init(lastUpdatedTime: Int64? = nil, logGroupIdentifier: String? = nil, policyDocument: String? = nil) {
            self.lastUpdatedTime = lastUpdatedTime
            self.logGroupIdentifier = logGroupIdentifier
            self.policyDocument = policyDocument
        }

        private enum CodingKeys: String, CodingKey {
            case lastUpdatedTime
            case logGroupIdentifier
            case policyDocument
        }
    }

    public struct GetLogEventsRequest: AWSEncodableShape {
        /// The end of the time range, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp equal to or later than this time are not included.
        public let endTime: Int64?
        /// The maximum number of log events returned. If you don't specify a limit, the default is as many log events as can fit in a response size of 1 MB (up to 10,000 log events).
        public let limit: Int?
        /// Specify either the name or ARN of the log group to view events from. If the log group is in a source account and you are using a monitoring account, you must use the log group ARN. If you specify values for both logGroupName and logGroupIdentifier,  the action returns an InvalidParameterException error.
        public let logGroupIdentifier: String?
        /// The name of the log group.   If you specify values for both logGroupName and logGroupIdentifier,  the action returns an InvalidParameterException error.
        public let logGroupName: String
        /// The name of the log stream.
        public let logStreamName: String
        /// The token for the next set of items to return. (You received this token from a previous call.)
        public let nextToken: String?
        /// If the value is true, the earliest log events are returned first. If the value is false, the latest log events are returned first. The default value is false. If you are using a previous nextForwardToken value as the nextToken in this operation,  you must specify true for startFromHead.
        public let startFromHead: Bool?
        /// The start of the time range, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. Events with a timestamp equal to this time or later than this time are included. Events with a timestamp earlier than this time are not included.
        public let startTime: Int64?
        /// Specify true to display the log event fields with all sensitive data unmasked and visible. The default is false. To use this operation with this parameter, you must be signed into an account with the logs:Unmask permission.
        public let unmask: Bool?

        public init(endTime: Int64? = nil, limit: Int? = nil, logGroupIdentifier: String? = nil, logGroupName: String, logStreamName: String, nextToken: String? = nil, startFromHead: Bool? = nil, startTime: Int64? = nil, unmask: Bool? = nil) {
            self.endTime = endTime
            self.limit = limit
            self.logGroupIdentifier = logGroupIdentifier
            self.logGroupName = logGroupName
            self.logStreamName = logStreamName
            self.nextToken = nextToken
            self.startFromHead = startFromHead
            self.startTime = startTime
            self.unmask = unmask
        }

        public func validate(name: String) throws {
            try self.validate(self.endTime, name: "endTime", parent: name, min: 0)
            try self.validate(self.limit, name: "limit", parent: name, max: 10000)
            try self.validate(self.limit, name: "limit", parent: name, min: 1)
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, max: 2048)
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, min: 1)
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, pattern: "^[\\w#+=/:,.@-]*$")
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
            try self.validate(self.logStreamName, name: "logStreamName", parent: name, max: 512)
            try self.validate(self.logStreamName, name: "logStreamName", parent: name, min: 1)
            try self.validate(self.logStreamName, name: "logStreamName", parent: name, pattern: "^[^:*]*$")
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
            try self.validate(self.startTime, name: "startTime", parent: name, min: 0)
        }

        private enum CodingKeys: String, CodingKey {
            case endTime
            case limit
            case logGroupIdentifier
            case logGroupName
            case logStreamName
            case nextToken
            case startFromHead
            case startTime
            case unmask
        }
    }

    public struct GetLogEventsResponse: AWSDecodableShape {
        /// The events.
        public let events: [OutputLogEvent]?
        /// The token for the next set of items in the backward direction. The token expires after 24 hours. This token is not null. If you have reached the end of the stream, it returns the same token you passed in.
        public let nextBackwardToken: String?
        /// The token for the next set of items in the forward direction. The token expires after 24 hours. If you have reached the end of the stream, it returns the same token you passed in.
        public let nextForwardToken: String?

        public init(events: [OutputLogEvent]? = nil, nextBackwardToken: String? = nil, nextForwardToken: String? = nil) {
            self.events = events
            self.nextBackwardToken = nextBackwardToken
            self.nextForwardToken = nextForwardToken
        }

        private enum CodingKeys: String, CodingKey {
            case events
            case nextBackwardToken
            case nextForwardToken
        }
    }

    public struct GetLogGroupFieldsRequest: AWSEncodableShape {
        /// Specify either the name or ARN of the log group to view. If the log group is in a source account and you are using a monitoring account, you must specify the ARN. If you specify values for both logGroupName and logGroupIdentifier, the action returns an InvalidParameterException error.
        public let logGroupIdentifier: String?
        /// The name of the log group to search. If you specify values for both logGroupName and logGroupIdentifier, the action returns an InvalidParameterException error.
        public let logGroupName: String
        /// The time to set as the center of the query. If you specify time, the 15 minutes before this time are queries. If you omit time, the 8 minutes before and 8 minutes after this time are searched. The time value is specified as epoch time, which is the number of seconds since January 1, 1970, 00:00:00 UTC.
        public let time: Int64?

        public init(logGroupIdentifier: String? = nil, logGroupName: String, time: Int64? = nil) {
            self.logGroupIdentifier = logGroupIdentifier
            self.logGroupName = logGroupName
            self.time = time
        }

        public func validate(name: String) throws {
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, max: 2048)
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, min: 1)
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, pattern: "^[\\w#+=/:,.@-]*$")
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
            try self.validate(self.time, name: "time", parent: name, min: 0)
        }

        private enum CodingKeys: String, CodingKey {
            case logGroupIdentifier
            case logGroupName
            case time
        }
    }

    public struct GetLogGroupFieldsResponse: AWSDecodableShape {
        /// The array of fields found in the query. Each object in the array contains the name of the field, along with the percentage of time it appeared in the log events that were queried.
        public let logGroupFields: [LogGroupField]?

        public init(logGroupFields: [LogGroupField]? = nil) {
            self.logGroupFields = logGroupFields
        }

        private enum CodingKeys: String, CodingKey {
            case logGroupFields
        }
    }

    public struct GetLogRecordRequest: AWSEncodableShape {
        /// The pointer corresponding to the log event record you want to retrieve. You get this from the response of a GetQueryResults operation. In that response, the value of the @ptr field for a log event is the value to use as logRecordPointer to retrieve that complete log event record.
        public let logRecordPointer: String
        /// Specify true to display the log event fields with all sensitive data unmasked and visible. The default is false. To use this operation with this parameter, you must be signed into an account with the logs:Unmask permission.
        public let unmask: Bool?

        public init(logRecordPointer: String, unmask: Bool? = nil) {
            self.logRecordPointer = logRecordPointer
            self.unmask = unmask
        }

        private enum CodingKeys: String, CodingKey {
            case logRecordPointer
            case unmask
        }
    }

    public struct GetLogRecordResponse: AWSDecodableShape {
        /// The requested log event, as a JSON string.
        public let logRecord: [String: String]?

        public init(logRecord: [String: String]? = nil) {
            self.logRecord = logRecord
        }

        private enum CodingKeys: String, CodingKey {
            case logRecord
        }
    }

    public struct GetQueryResultsRequest: AWSEncodableShape {
        /// The ID number of the query.
        public let queryId: String

        public init(queryId: String) {
            self.queryId = queryId
        }

        public func validate(name: String) throws {
            try self.validate(self.queryId, name: "queryId", parent: name, max: 256)
        }

        private enum CodingKeys: String, CodingKey {
            case queryId
        }
    }

    public struct GetQueryResultsResponse: AWSDecodableShape {
        /// The log events that matched the query criteria during the most recent time it ran. The results value is an array of arrays. Each log event is one object in the top-level array. Each of these log event objects is an array of field/value pairs.
        public let results: [[ResultField]]?
        /// Includes the number of log events scanned by the query, the number of log events that matched the  query criteria, and the total number of bytes in the log events that were scanned. These values reflect the full raw results of the query.
        public let statistics: QueryStatistics?
        /// The status of the most recent running of the query. Possible values are Cancelled,  Complete, Failed, Running, Scheduled,  Timeout, and Unknown. Queries time out after 15 minutes of runtime. To avoid having your queries time out, reduce the time range being searched or partition your query into a number of queries.
        public let status: QueryStatus?

        public init(results: [[ResultField]]? = nil, statistics: QueryStatistics? = nil, status: QueryStatus? = nil) {
            self.results = results
            self.statistics = statistics
            self.status = status
        }

        private enum CodingKeys: String, CodingKey {
            case results
            case statistics
            case status
        }
    }

    public struct InputLogEvent: AWSEncodableShape {
        /// The raw event message.
        public let message: String
        /// The time the event occurred, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
        public let timestamp: Int64

        public init(message: String, timestamp: Int64) {
            self.message = message
            self.timestamp = timestamp
        }

        public func validate(name: String) throws {
            try self.validate(self.message, name: "message", parent: name, min: 1)
            try self.validate(self.timestamp, name: "timestamp", parent: name, min: 0)
        }

        private enum CodingKeys: String, CodingKey {
            case message
            case timestamp
        }
    }

    public struct ListTagsForResourceRequest: AWSEncodableShape {
        /// The ARN of the  resource that you want to view tags for. The ARN format of a log group is  arn:aws:logs:Region:account-id:log-group:log-group-name   The ARN format of a destination is  arn:aws:logs:Region:account-id:destination:destination-name   For more information about ARN format, see CloudWatch Logs  resources and operations.
        public let resourceArn: String

        public init(resourceArn: String) {
            self.resourceArn = resourceArn
        }

        public func validate(name: String) throws {
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, max: 1011)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, min: 1)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, pattern: "^[\\w+=/:,.@-]*$")
        }

        private enum CodingKeys: String, CodingKey {
            case resourceArn
        }
    }

    public struct ListTagsForResourceResponse: AWSDecodableShape {
        /// The list of tags associated with the requested resource.>
        public let tags: [String: String]?

        public init(tags: [String: String]? = nil) {
            self.tags = tags
        }

        private enum CodingKeys: String, CodingKey {
            case tags
        }
    }

    public struct ListTagsLogGroupRequest: AWSEncodableShape {
        /// The name of the log group.
        public let logGroupName: String

        public init(logGroupName: String) {
            self.logGroupName = logGroupName
        }

        public func validate(name: String) throws {
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case logGroupName
        }
    }

    public struct ListTagsLogGroupResponse: AWSDecodableShape {
        /// The tags for the log group.
        public let tags: [String: String]?

        public init(tags: [String: String]? = nil) {
            self.tags = tags
        }

        private enum CodingKeys: String, CodingKey {
            case tags
        }
    }

    public struct LogGroup: AWSDecodableShape {
        /// The Amazon Resource Name (ARN) of the log group.
        public let arn: String?
        /// The creation time of the log group, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
        public let creationTime: Int64?
        /// Displays whether this log group has a protection policy, or whether it had one in the past. For more information, see  PutDataProtectionPolicy.
        public let dataProtectionStatus: DataProtectionStatus?
        /// The Amazon Resource Name (ARN) of the KMS key to use when encrypting log data.
        public let kmsKeyId: String?
        /// The name of the log group.
        public let logGroupName: String?
        /// The number of metric filters.
        public let metricFilterCount: Int?
        public let retentionInDays: Int?
        /// The number of bytes stored.
        public let storedBytes: Int64?

        public init(arn: String? = nil, creationTime: Int64? = nil, dataProtectionStatus: DataProtectionStatus? = nil, kmsKeyId: String? = nil, logGroupName: String? = nil, metricFilterCount: Int? = nil, retentionInDays: Int? = nil, storedBytes: Int64? = nil) {
            self.arn = arn
            self.creationTime = creationTime
            self.dataProtectionStatus = dataProtectionStatus
            self.kmsKeyId = kmsKeyId
            self.logGroupName = logGroupName
            self.metricFilterCount = metricFilterCount
            self.retentionInDays = retentionInDays
            self.storedBytes = storedBytes
        }

        private enum CodingKeys: String, CodingKey {
            case arn
            case creationTime
            case dataProtectionStatus
            case kmsKeyId
            case logGroupName
            case metricFilterCount
            case retentionInDays
            case storedBytes
        }
    }

    public struct LogGroupField: AWSDecodableShape {
        /// The name of a log field.
        public let name: String?
        /// The percentage of log events queried that contained the field.
        public let percent: Int?

        public init(name: String? = nil, percent: Int? = nil) {
            self.name = name
            self.percent = percent
        }

        private enum CodingKeys: String, CodingKey {
            case name
            case percent
        }
    }

    public struct LogStream: AWSDecodableShape {
        /// The Amazon Resource Name (ARN) of the log stream.
        public let arn: String?
        /// The creation time of the stream, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
        public let creationTime: Int64?
        /// The time of the first event, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
        public let firstEventTimestamp: Int64?
        /// The time of the most recent log event in the log stream in CloudWatch Logs. This number is expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. The lastEventTime value updates on an eventual consistency basis. It typically updates in less than an hour from ingestion, but in rare situations might take longer.
        public let lastEventTimestamp: Int64?
        /// The ingestion time, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
        public let lastIngestionTime: Int64?
        /// The name of the log stream.
        public let logStreamName: String?
        /// The number of bytes stored.  Important: As of June 17, 2019, this parameter is no longer supported for log streams, and is always reported as zero. This change applies only to log streams. The storedBytes parameter for log groups is not affected.
        public let storedBytes: Int64?
        /// The sequence token.
        public let uploadSequenceToken: String?

        public init(arn: String? = nil, creationTime: Int64? = nil, firstEventTimestamp: Int64? = nil, lastEventTimestamp: Int64? = nil, lastIngestionTime: Int64? = nil, logStreamName: String? = nil, uploadSequenceToken: String? = nil) {
            self.arn = arn
            self.creationTime = creationTime
            self.firstEventTimestamp = firstEventTimestamp
            self.lastEventTimestamp = lastEventTimestamp
            self.lastIngestionTime = lastIngestionTime
            self.logStreamName = logStreamName
            self.storedBytes = nil
            self.uploadSequenceToken = uploadSequenceToken
        }

        @available(*, deprecated, message: "Members storedBytes have been deprecated")
        public init(arn: String? = nil, creationTime: Int64? = nil, firstEventTimestamp: Int64? = nil, lastEventTimestamp: Int64? = nil, lastIngestionTime: Int64? = nil, logStreamName: String? = nil, storedBytes: Int64? = nil, uploadSequenceToken: String? = nil) {
            self.arn = arn
            self.creationTime = creationTime
            self.firstEventTimestamp = firstEventTimestamp
            self.lastEventTimestamp = lastEventTimestamp
            self.lastIngestionTime = lastIngestionTime
            self.logStreamName = logStreamName
            self.storedBytes = storedBytes
            self.uploadSequenceToken = uploadSequenceToken
        }

        private enum CodingKeys: String, CodingKey {
            case arn
            case creationTime
            case firstEventTimestamp
            case lastEventTimestamp
            case lastIngestionTime
            case logStreamName
            case storedBytes
            case uploadSequenceToken
        }
    }

    public struct MetricFilter: AWSDecodableShape {
        /// The creation time of the metric filter, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
        public let creationTime: Int64?
        /// The name of the metric filter.
        public let filterName: String?
        public let filterPattern: String?
        /// The name of the log group.
        public let logGroupName: String?
        /// The metric transformations.
        public let metricTransformations: [MetricTransformation]?

        public init(creationTime: Int64? = nil, filterName: String? = nil, filterPattern: String? = nil, logGroupName: String? = nil, metricTransformations: [MetricTransformation]? = nil) {
            self.creationTime = creationTime
            self.filterName = filterName
            self.filterPattern = filterPattern
            self.logGroupName = logGroupName
            self.metricTransformations = metricTransformations
        }

        private enum CodingKeys: String, CodingKey {
            case creationTime
            case filterName
            case filterPattern
            case logGroupName
            case metricTransformations
        }
    }

    public struct MetricFilterMatchRecord: AWSDecodableShape {
        /// The raw event data.
        public let eventMessage: String?
        /// The event number.
        public let eventNumber: Int64?
        /// The values extracted from the event data by the filter.
        public let extractedValues: [String: String]?

        public init(eventMessage: String? = nil, eventNumber: Int64? = nil, extractedValues: [String: String]? = nil) {
            self.eventMessage = eventMessage
            self.eventNumber = eventNumber
            self.extractedValues = extractedValues
        }

        private enum CodingKeys: String, CodingKey {
            case eventMessage
            case eventNumber
            case extractedValues
        }
    }

    public struct MetricTransformation: AWSEncodableShape & AWSDecodableShape {
        /// (Optional) The value to emit when a filter pattern does not match a log event.  This value can be null.
        public let defaultValue: Double?
        /// The fields to use as dimensions for the metric. One metric filter can include as many as three dimensions.  Metrics extracted from log events are charged as custom metrics. To prevent unexpected high charges, do not specify high-cardinality fields such as  IPAddress or requestID as dimensions. Each different value  found for  a dimension is treated as a separate metric and accrues charges as a separate custom metric.  CloudWatch Logs disables a metric filter if it generates 1000 different name/value pairs for your specified dimensions within a certain amount of time. This helps to prevent accidental high charges. You can also set up a billing alarm to alert you if your charges are higher than  expected. For more information,  see  Creating a Billing Alarm to Monitor Your Estimated Amazon Web Services Charges.
        public let dimensions: [String: String]?
        /// The name of the CloudWatch metric.
        public let metricName: String
        /// A custom namespace to contain your metric in CloudWatch. Use namespaces to group together metrics that are similar. For more information, see Namespaces.
        public let metricNamespace: String
        /// The value to publish to the CloudWatch metric when a filter pattern matches a log event.
        public let metricValue: String
        /// The unit to assign to the metric. If you omit this, the unit is set as None.
        public let unit: StandardUnit?

        public init(defaultValue: Double? = nil, dimensions: [String: String]? = nil, metricName: String, metricNamespace: String, metricValue: String, unit: StandardUnit? = nil) {
            self.defaultValue = defaultValue
            self.dimensions = dimensions
            self.metricName = metricName
            self.metricNamespace = metricNamespace
            self.metricValue = metricValue
            self.unit = unit
        }

        public func validate(name: String) throws {
            try self.dimensions?.forEach {
                try validate($0.key, name: "dimensions.key", parent: name, max: 255)
                try validate($0.value, name: "dimensions[\"\($0.key)\"]", parent: name, max: 255)
            }
            try self.validate(self.metricName, name: "metricName", parent: name, max: 255)
            try self.validate(self.metricName, name: "metricName", parent: name, pattern: "^[^:*$]*$")
            try self.validate(self.metricNamespace, name: "metricNamespace", parent: name, max: 255)
            try self.validate(self.metricNamespace, name: "metricNamespace", parent: name, pattern: "^[^:*$]*$")
            try self.validate(self.metricValue, name: "metricValue", parent: name, max: 100)
        }

        private enum CodingKeys: String, CodingKey {
            case defaultValue
            case dimensions
            case metricName
            case metricNamespace
            case metricValue
            case unit
        }
    }

    public struct OutputLogEvent: AWSDecodableShape {
        /// The time the event was ingested, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
        public let ingestionTime: Int64?
        /// The data contained in the log event.
        public let message: String?
        /// The time the event occurred, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
        public let timestamp: Int64?

        public init(ingestionTime: Int64? = nil, message: String? = nil, timestamp: Int64? = nil) {
            self.ingestionTime = ingestionTime
            self.message = message
            self.timestamp = timestamp
        }

        private enum CodingKeys: String, CodingKey {
            case ingestionTime
            case message
            case timestamp
        }
    }

    public struct PutDataProtectionPolicyRequest: AWSEncodableShape {
        /// Specify either the log group name or log group ARN.
        public let logGroupIdentifier: String
        /// Specify the data protection policy, in JSON. This policy must include two JSON blocks:   The first block must include both a DataIdentifer array and an  Operation property with an Audit action. The DataIdentifer array lists the types of sensitive data that you want to mask. For more information about the available options, see  Types of data that you can mask. The Operation property with an Audit action is required to find the  sensitive data terms. This Audit action must contain a FindingsDestination object. You can optionally use that FindingsDestination object to list one or more  destinations to send audit findings to. If you specify destinations such as log groups,  Kinesis Data Firehose streams, and S3 buckets, they must already exist.   The second block must include both a DataIdentifer array and an Operation property with an Deidentify action. The DataIdentifer array must exactly match the DataIdentifer array in the first block of the policy. The Operation property with the Deidentify action is what actually masks the  data, and it must  contain the  "MaskConfig": {} object. The  "MaskConfig": {} object must be empty.   For an example data protection policy, see the Examples section on this page.  The contents of two DataIdentifer arrays must match exactly.
        public let policyDocument: String

        public init(logGroupIdentifier: String, policyDocument: String) {
            self.logGroupIdentifier = logGroupIdentifier
            self.policyDocument = policyDocument
        }

        public func validate(name: String) throws {
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, max: 2048)
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, min: 1)
            try self.validate(self.logGroupIdentifier, name: "logGroupIdentifier", parent: name, pattern: "^[\\w#+=/:,.@-]*$")
        }

        private enum CodingKeys: String, CodingKey {
            case logGroupIdentifier
            case policyDocument
        }
    }

    public struct PutDataProtectionPolicyResponse: AWSDecodableShape {
        /// The date and time that this policy was most recently updated.
        public let lastUpdatedTime: Int64?
        /// The log group name or ARN that you specified in your request.
        public let logGroupIdentifier: String?
        /// The data protection policy used for this log group.
        public let policyDocument: String?

        public init(lastUpdatedTime: Int64? = nil, logGroupIdentifier: String? = nil, policyDocument: String? = nil) {
            self.lastUpdatedTime = lastUpdatedTime
            self.logGroupIdentifier = logGroupIdentifier
            self.policyDocument = policyDocument
        }

        private enum CodingKeys: String, CodingKey {
            case lastUpdatedTime
            case logGroupIdentifier
            case policyDocument
        }
    }

    public struct PutDestinationPolicyRequest: AWSEncodableShape {
        /// An IAM policy document that authorizes cross-account users to deliver their log events to the associated destination. This can be up to 5120 bytes.
        public let accessPolicy: String
        /// A name for an existing destination.
        public let destinationName: String
        /// Specify true if you are updating an existing destination policy to grant permission to an organization ID instead of granting permission to individual AWS accounts. Before you update a destination policy this way, you must first update the subscription filters in the accounts that send logs to this destination. If you do not, the subscription filters might stop working. By specifying true for forceUpdate, you are affirming that you have already updated the subscription  filters. For more information, see  Updating an existing cross-account subscription  If you omit this parameter, the default of false is used.
        public let forceUpdate: Bool?

        public init(accessPolicy: String, destinationName: String, forceUpdate: Bool? = nil) {
            self.accessPolicy = accessPolicy
            self.destinationName = destinationName
            self.forceUpdate = forceUpdate
        }

        public func validate(name: String) throws {
            try self.validate(self.accessPolicy, name: "accessPolicy", parent: name, min: 1)
            try self.validate(self.destinationName, name: "destinationName", parent: name, max: 512)
            try self.validate(self.destinationName, name: "destinationName", parent: name, min: 1)
            try self.validate(self.destinationName, name: "destinationName", parent: name, pattern: "^[^:*]*$")
        }

        private enum CodingKeys: String, CodingKey {
            case accessPolicy
            case destinationName
            case forceUpdate
        }
    }

    public struct PutDestinationRequest: AWSEncodableShape {
        /// A name for the destination.
        public let destinationName: String
        /// The ARN of an IAM role that grants CloudWatch Logs permissions to call the Amazon Kinesis PutRecord operation on the destination stream.
        public let roleArn: String
        /// An optional list of key-value pairs to associate with the resource. For more information about tagging, see  Tagging Amazon Web Services resources
        public let tags: [String: String]?
        /// The ARN of an Amazon Kinesis stream to which to deliver matching log events.
        public let targetArn: String

        public init(destinationName: String, roleArn: String, tags: [String: String]? = nil, targetArn: String) {
            self.destinationName = destinationName
            self.roleArn = roleArn
            self.tags = tags
            self.targetArn = targetArn
        }

        public func validate(name: String) throws {
            try self.validate(self.destinationName, name: "destinationName", parent: name, max: 512)
            try self.validate(self.destinationName, name: "destinationName", parent: name, min: 1)
            try self.validate(self.destinationName, name: "destinationName", parent: name, pattern: "^[^:*]*$")
            try self.validate(self.roleArn, name: "roleArn", parent: name, min: 1)
            try self.tags?.forEach {
                try validate($0.key, name: "tags.key", parent: name, max: 128)
                try validate($0.key, name: "tags.key", parent: name, min: 1)
                try validate($0.key, name: "tags.key", parent: name, pattern: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]+)$")
                try validate($0.value, name: "tags[\"\($0.key)\"]", parent: name, max: 256)
                try validate($0.value, name: "tags[\"\($0.key)\"]", parent: name, pattern: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$")
            }
            try self.validate(self.tags, name: "tags", parent: name, max: 50)
            try self.validate(self.tags, name: "tags", parent: name, min: 1)
            try self.validate(self.targetArn, name: "targetArn", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case destinationName
            case roleArn
            case tags
            case targetArn
        }
    }

    public struct PutDestinationResponse: AWSDecodableShape {
        /// The destination.
        public let destination: Destination?

        public init(destination: Destination? = nil) {
            self.destination = destination
        }

        private enum CodingKeys: String, CodingKey {
            case destination
        }
    }

    public struct PutLogEventsRequest: AWSEncodableShape {
        /// The log events.
        public let logEvents: [InputLogEvent]
        /// The name of the log group.
        public let logGroupName: String
        /// The name of the log stream.
        public let logStreamName: String
        /// The sequence token obtained from the response of the previous PutLogEvents call. An upload in a newly created log stream does not require a sequence token. You can also get the sequence token using DescribeLogStreams. If you call PutLogEvents twice within a narrow time period using the same value for sequenceToken, both calls might be successful or one might be rejected.
        public let sequenceToken: String?

        public init(logEvents: [InputLogEvent], logGroupName: String, logStreamName: String, sequenceToken: String? = nil) {
            self.logEvents = logEvents
            self.logGroupName = logGroupName
            self.logStreamName = logStreamName
            self.sequenceToken = sequenceToken
        }

        public func validate(name: String) throws {
            try self.logEvents.forEach {
                try $0.validate(name: "\(name).logEvents[]")
            }
            try self.validate(self.logEvents, name: "logEvents", parent: name, max: 10000)
            try self.validate(self.logEvents, name: "logEvents", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
            try self.validate(self.logStreamName, name: "logStreamName", parent: name, max: 512)
            try self.validate(self.logStreamName, name: "logStreamName", parent: name, min: 1)
            try self.validate(self.logStreamName, name: "logStreamName", parent: name, pattern: "^[^:*]*$")
            try self.validate(self.sequenceToken, name: "sequenceToken", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case logEvents
            case logGroupName
            case logStreamName
            case sequenceToken
        }
    }

    public struct PutLogEventsResponse: AWSDecodableShape {
        /// The next sequence token.
        public let nextSequenceToken: String?
        /// The rejected events.
        public let rejectedLogEventsInfo: RejectedLogEventsInfo?

        public init(nextSequenceToken: String? = nil, rejectedLogEventsInfo: RejectedLogEventsInfo? = nil) {
            self.nextSequenceToken = nextSequenceToken
            self.rejectedLogEventsInfo = rejectedLogEventsInfo
        }

        private enum CodingKeys: String, CodingKey {
            case nextSequenceToken
            case rejectedLogEventsInfo
        }
    }

    public struct PutMetricFilterRequest: AWSEncodableShape {
        /// A name for the metric filter.
        public let filterName: String
        /// A filter pattern for extracting metric data out of ingested log events.
        public let filterPattern: String
        /// The name of the log group.
        public let logGroupName: String
        /// A collection of information that defines how metric data gets emitted.
        public let metricTransformations: [MetricTransformation]

        public init(filterName: String, filterPattern: String, logGroupName: String, metricTransformations: [MetricTransformation]) {
            self.filterName = filterName
            self.filterPattern = filterPattern
            self.logGroupName = logGroupName
            self.metricTransformations = metricTransformations
        }

        public func validate(name: String) throws {
            try self.validate(self.filterName, name: "filterName", parent: name, max: 512)
            try self.validate(self.filterName, name: "filterName", parent: name, min: 1)
            try self.validate(self.filterName, name: "filterName", parent: name, pattern: "^[^:*]*$")
            try self.validate(self.filterPattern, name: "filterPattern", parent: name, max: 1024)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
            try self.metricTransformations.forEach {
                try $0.validate(name: "\(name).metricTransformations[]")
            }
            try self.validate(self.metricTransformations, name: "metricTransformations", parent: name, max: 1)
            try self.validate(self.metricTransformations, name: "metricTransformations", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case filterName
            case filterPattern
            case logGroupName
            case metricTransformations
        }
    }

    public struct PutQueryDefinitionRequest: AWSEncodableShape {
        /// Use this parameter to include specific log groups as part of your query definition. If you are updating a query definition and you omit this parameter, then the updated definition will contain no log groups.
        public let logGroupNames: [String]?
        /// A name for the query definition. If you are saving numerous query definitions, we recommend that you name them. This way, you can find the ones you want by using the first part of the name as a filter in the queryDefinitionNamePrefix parameter of DescribeQueryDefinitions.
        public let name: String
        /// If you are updating a query definition, use this parameter to specify the ID of the query definition that you want to update. You can use DescribeQueryDefinitions to retrieve the IDs of your saved query definitions. If you are creating a query definition, do not specify this parameter. CloudWatch generates a unique ID for the new query definition and include it in the response to this operation.
        public let queryDefinitionId: String?
        /// The query string to use for this definition.  For more information, see CloudWatch Logs Insights Query Syntax.
        public let queryString: String

        public init(logGroupNames: [String]? = nil, name: String, queryDefinitionId: String? = nil, queryString: String) {
            self.logGroupNames = logGroupNames
            self.name = name
            self.queryDefinitionId = queryDefinitionId
            self.queryString = queryString
        }

        public func validate(name: String) throws {
            try self.logGroupNames?.forEach {
                try validate($0, name: "logGroupNames[]", parent: name, max: 512)
                try validate($0, name: "logGroupNames[]", parent: name, min: 1)
                try validate($0, name: "logGroupNames[]", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
            }
            try self.validate(self.name, name: "name", parent: name, max: 255)
            try self.validate(self.name, name: "name", parent: name, min: 1)
            try self.validate(self.name, name: "name", parent: name, pattern: "^([^:*\\/]+\\/?)*[^:*\\/]+$")
            try self.validate(self.queryDefinitionId, name: "queryDefinitionId", parent: name, max: 256)
            try self.validate(self.queryString, name: "queryString", parent: name, max: 10000)
            try self.validate(self.queryString, name: "queryString", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case logGroupNames
            case name
            case queryDefinitionId
            case queryString
        }
    }

    public struct PutQueryDefinitionResponse: AWSDecodableShape {
        /// The ID of the query definition.
        public let queryDefinitionId: String?

        public init(queryDefinitionId: String? = nil) {
            self.queryDefinitionId = queryDefinitionId
        }

        private enum CodingKeys: String, CodingKey {
            case queryDefinitionId
        }
    }

    public struct PutResourcePolicyRequest: AWSEncodableShape {
        /// Details of the new policy, including the identity of the principal that is enabled to put logs to this account. This is formatted as a JSON string. This parameter is required. The following example creates a resource policy enabling the Route 53 service to put DNS query logs in to the specified log group. Replace "logArn" with the ARN of  your CloudWatch Logs resource, such as a log group or log stream. CloudWatch Logs also supports aws:SourceArn and aws:SourceAccount
        /// condition context keys. In the example resource policy, you would replace the value of SourceArn with the resource making the call from Route 53 to CloudWatch Logs. You would also replace the value of SourceAccount with the Amazon Web Services account ID making that call.   { "Version": "2012-10-17", "Statement": [ { "Sid": "Route53LogsToCloudWatchLogs", "Effect": "Allow", "Principal": { "Service": [ "route53.amazonaws.com" ] }, "Action": "logs:PutLogEvents", "Resource": "logArn", "Condition": { "ArnLike": { "aws:SourceArn": "myRoute53ResourceArn" }, "StringEquals": { "aws:SourceAccount": "myAwsAccountId" } } } ]
        /// }
        public let policyDocument: String?
        /// Name of the new policy. This parameter is required.
        public let policyName: String?

        public init(policyDocument: String? = nil, policyName: String? = nil) {
            self.policyDocument = policyDocument
            self.policyName = policyName
        }

        public func validate(name: String) throws {
            try self.validate(self.policyDocument, name: "policyDocument", parent: name, max: 5120)
            try self.validate(self.policyDocument, name: "policyDocument", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case policyDocument
            case policyName
        }
    }

    public struct PutResourcePolicyResponse: AWSDecodableShape {
        /// The new policy.
        public let resourcePolicy: ResourcePolicy?

        public init(resourcePolicy: ResourcePolicy? = nil) {
            self.resourcePolicy = resourcePolicy
        }

        private enum CodingKeys: String, CodingKey {
            case resourcePolicy
        }
    }

    public struct PutRetentionPolicyRequest: AWSEncodableShape {
        /// The name of the log group.
        public let logGroupName: String
        public let retentionInDays: Int

        public init(logGroupName: String, retentionInDays: Int) {
            self.logGroupName = logGroupName
            self.retentionInDays = retentionInDays
        }

        public func validate(name: String) throws {
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case logGroupName
            case retentionInDays
        }
    }

    public struct PutSubscriptionFilterRequest: AWSEncodableShape {
        /// The ARN of the destination to deliver matching log events to. Currently, the supported destinations are:   An Amazon Kinesis stream belonging to the same account as the subscription filter, for same-account delivery.   A logical destination (specified using an ARN) belonging to a different account,  for cross-account delivery. If you're setting up a cross-account subscription, the destination must have an IAM policy associated with it. The IAM policy must allow the sender to send logs to the destination. For more information, see PutDestinationPolicy.   A Kinesis Data Firehose delivery stream belonging to the same account as the subscription filter, for same-account delivery.   A Lambda function belonging to the same account as the subscription filter, for same-account delivery.
        public let destinationArn: String
        /// The method used to distribute log data to the destination. By default, log data is grouped by log stream, but the grouping can be set to random for a more even distribution. This property is only applicable when the destination is an Amazon Kinesis data stream.
        public let distribution: Distribution?
        /// A name for the subscription filter. If you are updating an existing filter, you must specify the correct name in filterName. To find the name of the filter currently associated with a log group, use DescribeSubscriptionFilters.
        public let filterName: String
        /// A filter pattern for subscribing to a filtered stream of log events.
        public let filterPattern: String
        /// The name of the log group.
        public let logGroupName: String
        /// The ARN of an IAM role that grants CloudWatch Logs permissions to deliver ingested log events to the destination stream. You don't need to provide the ARN when you are working with a logical destination for cross-account delivery.
        public let roleArn: String?

        public init(destinationArn: String, distribution: Distribution? = nil, filterName: String, filterPattern: String, logGroupName: String, roleArn: String? = nil) {
            self.destinationArn = destinationArn
            self.distribution = distribution
            self.filterName = filterName
            self.filterPattern = filterPattern
            self.logGroupName = logGroupName
            self.roleArn = roleArn
        }

        public func validate(name: String) throws {
            try self.validate(self.destinationArn, name: "destinationArn", parent: name, min: 1)
            try self.validate(self.filterName, name: "filterName", parent: name, max: 512)
            try self.validate(self.filterName, name: "filterName", parent: name, min: 1)
            try self.validate(self.filterName, name: "filterName", parent: name, pattern: "^[^:*]*$")
            try self.validate(self.filterPattern, name: "filterPattern", parent: name, max: 1024)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
            try self.validate(self.roleArn, name: "roleArn", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case destinationArn
            case distribution
            case filterName
            case filterPattern
            case logGroupName
            case roleArn
        }
    }

    public struct QueryDefinition: AWSDecodableShape {
        /// The date that the query definition was most recently modified.
        public let lastModified: Int64?
        /// If this query definition contains a list of log groups that it is limited to, that list appears here.
        public let logGroupNames: [String]?
        /// The name of the query definition.
        public let name: String?
        /// The unique ID of the query definition.
        public let queryDefinitionId: String?
        /// The query string to use for this definition. For more information, see CloudWatch Logs Insights Query Syntax.
        public let queryString: String?

        public init(lastModified: Int64? = nil, logGroupNames: [String]? = nil, name: String? = nil, queryDefinitionId: String? = nil, queryString: String? = nil) {
            self.lastModified = lastModified
            self.logGroupNames = logGroupNames
            self.name = name
            self.queryDefinitionId = queryDefinitionId
            self.queryString = queryString
        }

        private enum CodingKeys: String, CodingKey {
            case lastModified
            case logGroupNames
            case name
            case queryDefinitionId
            case queryString
        }
    }

    public struct QueryInfo: AWSDecodableShape {
        /// The date and time that this query was created.
        public let createTime: Int64?
        /// The name of the log group scanned by this query.
        public let logGroupName: String?
        /// The unique ID number of this query.
        public let queryId: String?
        /// The query string used in this query.
        public let queryString: String?
        /// The status of this query. Possible values are Cancelled, Complete, Failed, Running, Scheduled, and Unknown.
        public let status: QueryStatus?

        public init(createTime: Int64? = nil, logGroupName: String? = nil, queryId: String? = nil, queryString: String? = nil, status: QueryStatus? = nil) {
            self.createTime = createTime
            self.logGroupName = logGroupName
            self.queryId = queryId
            self.queryString = queryString
            self.status = status
        }

        private enum CodingKeys: String, CodingKey {
            case createTime
            case logGroupName
            case queryId
            case queryString
            case status
        }
    }

    public struct QueryStatistics: AWSDecodableShape {
        /// The total number of bytes in the log events scanned during the query.
        public let bytesScanned: Double?
        /// The number of log events that matched the query string.
        public let recordsMatched: Double?
        /// The total number of log events scanned during the query.
        public let recordsScanned: Double?

        public init(bytesScanned: Double? = nil, recordsMatched: Double? = nil, recordsScanned: Double? = nil) {
            self.bytesScanned = bytesScanned
            self.recordsMatched = recordsMatched
            self.recordsScanned = recordsScanned
        }

        private enum CodingKeys: String, CodingKey {
            case bytesScanned
            case recordsMatched
            case recordsScanned
        }
    }

    public struct RejectedLogEventsInfo: AWSDecodableShape {
        /// The expired log events.
        public let expiredLogEventEndIndex: Int?
        /// The log events that are too new.
        public let tooNewLogEventStartIndex: Int?
        /// The log events that are dated too far in the past.
        public let tooOldLogEventEndIndex: Int?

        public init(expiredLogEventEndIndex: Int? = nil, tooNewLogEventStartIndex: Int? = nil, tooOldLogEventEndIndex: Int? = nil) {
            self.expiredLogEventEndIndex = expiredLogEventEndIndex
            self.tooNewLogEventStartIndex = tooNewLogEventStartIndex
            self.tooOldLogEventEndIndex = tooOldLogEventEndIndex
        }

        private enum CodingKeys: String, CodingKey {
            case expiredLogEventEndIndex
            case tooNewLogEventStartIndex
            case tooOldLogEventEndIndex
        }
    }

    public struct ResourcePolicy: AWSDecodableShape {
        /// Timestamp showing when this policy was last updated, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
        public let lastUpdatedTime: Int64?
        /// The details of the policy.
        public let policyDocument: String?
        /// The name of the resource policy.
        public let policyName: String?

        public init(lastUpdatedTime: Int64? = nil, policyDocument: String? = nil, policyName: String? = nil) {
            self.lastUpdatedTime = lastUpdatedTime
            self.policyDocument = policyDocument
            self.policyName = policyName
        }

        private enum CodingKeys: String, CodingKey {
            case lastUpdatedTime
            case policyDocument
            case policyName
        }
    }

    public struct ResultField: AWSDecodableShape {
        /// The log event field.
        public let field: String?
        /// The value of this field.
        public let value: String?

        public init(field: String? = nil, value: String? = nil) {
            self.field = field
            self.value = value
        }

        private enum CodingKeys: String, CodingKey {
            case field
            case value
        }
    }

    public struct SearchedLogStream: AWSDecodableShape {
        /// The name of the log stream.
        public let logStreamName: String?
        /// Indicates whether all the events in this log stream were searched.
        public let searchedCompletely: Bool?

        public init(logStreamName: String? = nil, searchedCompletely: Bool? = nil) {
            self.logStreamName = logStreamName
            self.searchedCompletely = searchedCompletely
        }

        private enum CodingKeys: String, CodingKey {
            case logStreamName
            case searchedCompletely
        }
    }

    public struct StartQueryRequest: AWSEncodableShape {
        /// The end of the time range to query. The range is inclusive, so the specified end time is included in the query. Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC.
        public let endTime: Int64
        /// The maximum number of log events to return in the query. If the query string uses the fields command, only the specified fields and their values are returned. The default is 1000.
        public let limit: Int?
        /// The list of log groups to query. You can include up to 50 log groups. You can specify them by the log group name or ARN. If a log group that you're querying is in a source account and you're using a monitoring account, you must specify the ARN of the log group here. The query definition must also be defined in the monitoring account. If you specify an ARN, the ARN can't end with an asterisk (*). A StartQuery operation must include exactly one  of the following parameters:  logGroupName, logGroupNames or logGroupIdentifiers.
        public let logGroupIdentifiers: [String]?
        /// The log group on which to perform the query.  A StartQuery operation must include exactly one  of the following parameters:  logGroupName, logGroupNames or logGroupIdentifiers.
        public let logGroupName: String?
        /// The list of log groups to be queried. You can include up to 50 log groups.  A StartQuery operation must include exactly one  of the following parameters:  logGroupName, logGroupNames or logGroupIdentifiers.
        public let logGroupNames: [String]?
        /// The query string to use. For more information, see CloudWatch Logs Insights Query Syntax.
        public let queryString: String
        /// The beginning of the time range to query. The range is inclusive, so the specified start time is included in the query. Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC.
        public let startTime: Int64

        public init(endTime: Int64, limit: Int? = nil, logGroupIdentifiers: [String]? = nil, logGroupName: String? = nil, logGroupNames: [String]? = nil, queryString: String, startTime: Int64) {
            self.endTime = endTime
            self.limit = limit
            self.logGroupIdentifiers = logGroupIdentifiers
            self.logGroupName = logGroupName
            self.logGroupNames = logGroupNames
            self.queryString = queryString
            self.startTime = startTime
        }

        public func validate(name: String) throws {
            try self.validate(self.endTime, name: "endTime", parent: name, min: 0)
            try self.validate(self.limit, name: "limit", parent: name, max: 10000)
            try self.validate(self.limit, name: "limit", parent: name, min: 1)
            try self.logGroupIdentifiers?.forEach {
                try validate($0, name: "logGroupIdentifiers[]", parent: name, max: 2048)
                try validate($0, name: "logGroupIdentifiers[]", parent: name, min: 1)
                try validate($0, name: "logGroupIdentifiers[]", parent: name, pattern: "^[\\w#+=/:,.@-]*$")
            }
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
            try self.logGroupNames?.forEach {
                try validate($0, name: "logGroupNames[]", parent: name, max: 512)
                try validate($0, name: "logGroupNames[]", parent: name, min: 1)
                try validate($0, name: "logGroupNames[]", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
            }
            try self.validate(self.queryString, name: "queryString", parent: name, max: 10000)
            try self.validate(self.startTime, name: "startTime", parent: name, min: 0)
        }

        private enum CodingKeys: String, CodingKey {
            case endTime
            case limit
            case logGroupIdentifiers
            case logGroupName
            case logGroupNames
            case queryString
            case startTime
        }
    }

    public struct StartQueryResponse: AWSDecodableShape {
        /// The unique ID of the query.
        public let queryId: String?

        public init(queryId: String? = nil) {
            self.queryId = queryId
        }

        private enum CodingKeys: String, CodingKey {
            case queryId
        }
    }

    public struct StopQueryRequest: AWSEncodableShape {
        /// The ID number of the query to stop. To find this ID number, use DescribeQueries.
        public let queryId: String

        public init(queryId: String) {
            self.queryId = queryId
        }

        public func validate(name: String) throws {
            try self.validate(self.queryId, name: "queryId", parent: name, max: 256)
        }

        private enum CodingKeys: String, CodingKey {
            case queryId
        }
    }

    public struct StopQueryResponse: AWSDecodableShape {
        /// This is true if the query was stopped by the StopQuery operation.
        public let success: Bool?

        public init(success: Bool? = nil) {
            self.success = success
        }

        private enum CodingKeys: String, CodingKey {
            case success
        }
    }

    public struct SubscriptionFilter: AWSDecodableShape {
        /// The creation time of the subscription filter, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
        public let creationTime: Int64?
        /// The Amazon Resource Name (ARN) of the destination.
        public let destinationArn: String?
        public let distribution: Distribution?
        /// The name of the subscription filter.
        public let filterName: String?
        public let filterPattern: String?
        /// The name of the log group.
        public let logGroupName: String?
        public let roleArn: String?

        public init(creationTime: Int64? = nil, destinationArn: String? = nil, distribution: Distribution? = nil, filterName: String? = nil, filterPattern: String? = nil, logGroupName: String? = nil, roleArn: String? = nil) {
            self.creationTime = creationTime
            self.destinationArn = destinationArn
            self.distribution = distribution
            self.filterName = filterName
            self.filterPattern = filterPattern
            self.logGroupName = logGroupName
            self.roleArn = roleArn
        }

        private enum CodingKeys: String, CodingKey {
            case creationTime
            case destinationArn
            case distribution
            case filterName
            case filterPattern
            case logGroupName
            case roleArn
        }
    }

    public struct TagLogGroupRequest: AWSEncodableShape {
        /// The name of the log group.
        public let logGroupName: String
        /// The key-value pairs to use for the tags.
        public let tags: [String: String]

        public init(logGroupName: String, tags: [String: String]) {
            self.logGroupName = logGroupName
            self.tags = tags
        }

        public func validate(name: String) throws {
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
            try self.tags.forEach {
                try validate($0.key, name: "tags.key", parent: name, max: 128)
                try validate($0.key, name: "tags.key", parent: name, min: 1)
                try validate($0.key, name: "tags.key", parent: name, pattern: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]+)$")
                try validate($0.value, name: "tags[\"\($0.key)\"]", parent: name, max: 256)
                try validate($0.value, name: "tags[\"\($0.key)\"]", parent: name, pattern: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$")
            }
            try self.validate(self.tags, name: "tags", parent: name, max: 50)
            try self.validate(self.tags, name: "tags", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case logGroupName
            case tags
        }
    }

    public struct TagResourceRequest: AWSEncodableShape {
        /// The ARN of the  resource that you're adding tags to. The ARN format of a log group is  arn:aws:logs:Region:account-id:log-group:log-group-name   The ARN format of a destination is  arn:aws:logs:Region:account-id:destination:destination-name   For more information about ARN format, see CloudWatch Logs  resources and operations.
        public let resourceArn: String
        /// The list of key-value pairs to associate with the resource.
        public let tags: [String: String]

        public init(resourceArn: String, tags: [String: String]) {
            self.resourceArn = resourceArn
            self.tags = tags
        }

        public func validate(name: String) throws {
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, max: 1011)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, min: 1)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, pattern: "^[\\w+=/:,.@-]*$")
            try self.tags.forEach {
                try validate($0.key, name: "tags.key", parent: name, max: 128)
                try validate($0.key, name: "tags.key", parent: name, min: 1)
                try validate($0.key, name: "tags.key", parent: name, pattern: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]+)$")
                try validate($0.value, name: "tags[\"\($0.key)\"]", parent: name, max: 256)
                try validate($0.value, name: "tags[\"\($0.key)\"]", parent: name, pattern: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$")
            }
            try self.validate(self.tags, name: "tags", parent: name, max: 50)
            try self.validate(self.tags, name: "tags", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case resourceArn
            case tags
        }
    }

    public struct TestMetricFilterRequest: AWSEncodableShape {
        public let filterPattern: String
        /// The log event messages to test.
        public let logEventMessages: [String]

        public init(filterPattern: String, logEventMessages: [String]) {
            self.filterPattern = filterPattern
            self.logEventMessages = logEventMessages
        }

        public func validate(name: String) throws {
            try self.validate(self.filterPattern, name: "filterPattern", parent: name, max: 1024)
            try self.logEventMessages.forEach {
                try validate($0, name: "logEventMessages[]", parent: name, min: 1)
            }
            try self.validate(self.logEventMessages, name: "logEventMessages", parent: name, max: 50)
            try self.validate(self.logEventMessages, name: "logEventMessages", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case filterPattern
            case logEventMessages
        }
    }

    public struct TestMetricFilterResponse: AWSDecodableShape {
        /// The matched events.
        public let matches: [MetricFilterMatchRecord]?

        public init(matches: [MetricFilterMatchRecord]? = nil) {
            self.matches = matches
        }

        private enum CodingKeys: String, CodingKey {
            case matches
        }
    }

    public struct UntagLogGroupRequest: AWSEncodableShape {
        /// The name of the log group.
        public let logGroupName: String
        /// The tag keys. The corresponding tags are removed from the log group.
        public let tags: [String]

        public init(logGroupName: String, tags: [String]) {
            self.logGroupName = logGroupName
            self.tags = tags
        }

        public func validate(name: String) throws {
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, max: 512)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, min: 1)
            try self.validate(self.logGroupName, name: "logGroupName", parent: name, pattern: "^[\\.\\-_/#A-Za-z0-9]+$")
            try self.tags.forEach {
                try validate($0, name: "tags[]", parent: name, max: 128)
                try validate($0, name: "tags[]", parent: name, min: 1)
                try validate($0, name: "tags[]", parent: name, pattern: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]+)$")
            }
            try self.validate(self.tags, name: "tags", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case logGroupName
            case tags
        }
    }

    public struct UntagResourceRequest: AWSEncodableShape {
        /// The ARN of the CloudWatch Logs resource that you're removing tags from. The ARN format of a log group is  arn:aws:logs:Region:account-id:log-group:log-group-name   The ARN format of a destination is  arn:aws:logs:Region:account-id:destination:destination-name   For more information about ARN format, see CloudWatch Logs  resources and operations.
        public let resourceArn: String
        /// The list of tag keys to remove from the resource.
        public let tagKeys: [String]

        public init(resourceArn: String, tagKeys: [String]) {
            self.resourceArn = resourceArn
            self.tagKeys = tagKeys
        }

        public func validate(name: String) throws {
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, max: 1011)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, min: 1)
            try self.validate(self.resourceArn, name: "resourceArn", parent: name, pattern: "^[\\w+=/:,.@-]*$")
            try self.tagKeys.forEach {
                try validate($0, name: "tagKeys[]", parent: name, max: 128)
                try validate($0, name: "tagKeys[]", parent: name, min: 1)
                try validate($0, name: "tagKeys[]", parent: name, pattern: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]+)$")
            }
            try self.validate(self.tagKeys, name: "tagKeys", parent: name, max: 50)
        }

        private enum CodingKeys: String, CodingKey {
            case resourceArn
            case tagKeys
        }
    }
}

// MARK: - Errors

/// Error enum for CloudWatchLogs
public struct CloudWatchLogsErrorType: AWSErrorType {
    enum Code: String {
        case dataAlreadyAcceptedException = "DataAlreadyAcceptedException"
        case invalidOperationException = "InvalidOperationException"
        case invalidParameterException = "InvalidParameterException"
        case invalidSequenceTokenException = "InvalidSequenceTokenException"
        case limitExceededException = "LimitExceededException"
        case malformedQueryException = "MalformedQueryException"
        case operationAbortedException = "OperationAbortedException"
        case resourceAlreadyExistsException = "ResourceAlreadyExistsException"
        case resourceNotFoundException = "ResourceNotFoundException"
        case serviceUnavailableException = "ServiceUnavailableException"
        case tooManyTagsException = "TooManyTagsException"
        case unrecognizedClientException = "UnrecognizedClientException"
    }

    private let error: Code
    public let context: AWSErrorContext?

    /// initialize CloudWatchLogs
    public init?(errorCode: String, context: AWSErrorContext) {
        guard let error = Code(rawValue: errorCode) else { return nil }
        self.error = error
        self.context = context
    }

    internal init(_ error: Code) {
        self.error = error
        self.context = nil
    }

    /// return error code string
    public var errorCode: String { self.error.rawValue }

    /// The event was already logged.
    public static var dataAlreadyAcceptedException: Self { .init(.dataAlreadyAcceptedException) }
    /// The operation is not valid on the specified resource.
    public static var invalidOperationException: Self { .init(.invalidOperationException) }
    /// A parameter is specified incorrectly.
    public static var invalidParameterException: Self { .init(.invalidParameterException) }
    /// The sequence token is not valid. You can get the correct sequence token in  the expectedSequenceToken field in the InvalidSequenceTokenException message.
    public static var invalidSequenceTokenException: Self { .init(.invalidSequenceTokenException) }
    /// You have reached the maximum number of resources that can be created.
    public static var limitExceededException: Self { .init(.limitExceededException) }
    /// The query string is not valid. Details about this error are displayed in a  QueryCompileError object. For more information, see  QueryCompileError. For more information about valid query syntax, see CloudWatch Logs Insights Query Syntax.
    public static var malformedQueryException: Self { .init(.malformedQueryException) }
    /// Multiple concurrent requests to update the same resource were in conflict.
    public static var operationAbortedException: Self { .init(.operationAbortedException) }
    /// The specified resource already exists.
    public static var resourceAlreadyExistsException: Self { .init(.resourceAlreadyExistsException) }
    /// The specified resource does not exist.
    public static var resourceNotFoundException: Self { .init(.resourceNotFoundException) }
    /// The service cannot complete the request.
    public static var serviceUnavailableException: Self { .init(.serviceUnavailableException) }
    /// A resource can have no more than 50 tags.
    public static var tooManyTagsException: Self { .init(.tooManyTagsException) }
    /// The most likely cause is an Amazon Web Services access key ID or secret key that&#39;s not valid.
    public static var unrecognizedClientException: Self { .init(.unrecognizedClientException) }
}

extension CloudWatchLogsErrorType: Equatable {
    public static func == (lhs: CloudWatchLogsErrorType, rhs: CloudWatchLogsErrorType) -> Bool {
        lhs.error == rhs.error
    }
}

extension CloudWatchLogsErrorType: CustomStringConvertible {
    public var description: String {
        return "\(self.error.rawValue): \(self.message ?? "")"
    }
}
